function PressWinOpenExt(urlString) {
msgWindow = window.open(urlString,"preview_video","resizable=no,toolbar=no,location=no,scrollbars=no,status=yes,width=350,height=280");
}

function popupWindow(theURL, pvwidth, pvheight) {
 var newWindow = window.open(theURL,'imageSingle','width=' + pvwidth + ',height=' + pvheight + ',scrollbars=1,resizable=1,status=1');
 if(newWindow) {
 newWindow.focus();
 return false; // cancel link
 } else {
 return true; // follow link as normal
 }
}

function gotoURL(selectElement) {
 var URL = selectElement.options[selectElement.selectedIndex].value;
 if (URL != "") {
 window.location.href = URL;
 }
}

function addLightbox(photoId)
{
	var addIcon;
	var removeIcon;
	if (addIcon = getElement("lightbox_add_" + photoId))
	{
		if (removeIcon = getElement("lightbox_remove_" + photoId))
		{
			addIcon.style.display = 'none';
			removeIcon.style.display = 'inline';
			jQuery.get('/photos/'+photoId+';add_lightbox');
			return true;
		}
	}
	return false;
}

function removeLightbox(photoId)
{
	var addIcon;
	var removeIcon;
	if (addIcon = getElement("lightbox_add_" + photoId))
	{
		if (removeIcon = getElement("lightbox_remove_" + photoId))
		{
			addIcon.style.display = 'inline';
			removeIcon.style.display = 'none';
			jQuery.get('/photos/'+photoId+';remove_lightbox');
			return true;
		}
	}
	return false;
}

function addUniqueCollection(photoId)
{
	var addIcon;
	var removeIcon;
	if (addIcon = getElement("unique_collection_add_" + photoId))
	{
		if (removeIcon = getElement("unique_collection_remove_" + photoId))
		{
			addIcon.style.display = 'none';
			removeIcon.style.display = 'inline';
			jQuery.get('/photos/'+photoId+';add_unique_collection');
			return true;
		}
	}
	return false;
}

function removeUniqueCollection(photoId)
{
	var addIcon;
	var removeIcon;
	if (addIcon = getElement("unique_collection_add_" + photoId))
	{
		if (removeIcon = getElement("unique_collection_remove_" + photoId))
		{
			addIcon.style.display = 'inline';
			removeIcon.style.display = 'none';
			jQuery.get('/photos/'+photoId+';remove_unique_collection');
			return true;
		}
	}
	return false;
}

function getElement(elementId)
{
	if (document.getElementById(elementId))
	{
		return document.getElementById(elementId);
	}
	return false;
}